package com.csdj.t309springboot.controller;


import com.csdj.t309springboot.common.WebResult;
import com.csdj.t309springboot.common.WebResultMsgCode;
import com.csdj.t309springboot.entity.Carousel;
import com.csdj.t309springboot.service.CarouselService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 谭湛宇
 * @since 2022-01-10
 */
@RestController
@RequestMapping("/carousel")
public class CarouselController extends BaseController{
    @Resource
    private CarouselService carouselService;

    @PostMapping("/getAll")
    public WebResult getAll(){
        List<Carousel> list = carouselService.getAllCarousel();
        if(null != list){
            return new WebResult(WebResultMsgCode.SUCCESS).putData("list",list);
        }
        return new WebResult(WebResultMsgCode.FAIL);
    }

}
